﻿@model IEnumerable<LibMS.Models.LibDocuments>
@{
    ViewBag.Title = "Danh sách tài liệu";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<!-- Page info-->
<div id="pageInfo" class="well well-sm">
    <h4 class="text-success"><strong>Tài liệu thuộc danh mục: </strong></h4>
</div>
<!-- /. End Page info-->
<div class="row">
    <!-- Document item-->
    <div class="col-lg-8">
        @if (Convert.ToBoolean(ViewData["success"]) == true)
        {
            <div id="documentItems">
                @foreach (var item in Model)
                {
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <div>
                                <a href="@("/documents/detail/" + item.DocumentId)">
                                    <h4><strong>@item.DocumentName</strong></h4>
                                </a>
                            </div>

                            <div class="well well-sm">
                                <div class="row">
                                    <div class="col-lg-8 col-md-8">
                                        <b>Danh mục:</b>
                                        <a class="label label-success" href="/documents/category/@item.CategoryId" rel="tag">@item.CategoryName</a>
                                    </div>
                                    <div class="col-lg-4 col-md-4">
                                        <b>Đăng ngày: </b>
                                        <abbr class="published" title="@String.Format("{0:dd/MM/yyyy HH:mm:ss}", item.CreateDate.GetValueOrDefault(Convert.ToDateTime("01/01/2013")))"><strong>@String.Format("{0:dd/MM/yyyy}", item.CreateDate.GetValueOrDefault(Convert.ToDateTime("01/01/2013")))</strong></abbr>
                                    </div>
                                </div>
                            </div>

                            <div class="row" style="padding-left:15px;">
                                <div class="media">
                                    <a class="pull-left" href="@("/documents/detail/" + item.DocumentId)">
                                        <img class="img-thumbnail media-object" alt="100x130" style="width: 80px; height: 100px;" src="@(!string.IsNullOrEmpty(item.ThumbnaiPath) ? "../../Contents/Image/DocumentThumbnails/" + item.ThumbnaiPath : "../../Contents/Image/thumbnail-none.gif")">
                                    </a>
                                    <div class="media-body">
                                        <h4 class="media-heading">Mô tả tài liệu:</h4>
                                        @item.Descriptions
                                    </div>
                                </div>
                            </div>
                            <hr />
                            <div class="row">
                                <div class="col-md-10 col-sm-10">
                                    <p class="text-success"><strong>Lượt xem: <span class="badge">@item.ViewCount</span></strong></p>
                                </div>
                                <div class="col-md-2 col-sm-2">
                                    <a class="btn btn-success" href="@("/documents/detail/" + @item.DocumentId)"><strong>Chi tiết ...</strong></a>
                                </div>
                            </div>
                        </div>
                    </div>
                }
            </div>
            <!-- Paging-->
            <div class="text-center">
                <ul id="paging" style="margin-top: 20px;"></ul>
            </div>
            <!-- /. End Paging-->
        }
        else
        {

        }
    </div>
    <!-- /.End Document item-->
    <!-- Right menu-->
    <div class="col-lg-4">
        <div id="rmCategories" class="panel panel-primary">
            <div class="panel-heading">
                <h3 class="panel-title"><strong>Danh mục tài liệu</strong></h3>
            </div>
            <div class="list-group">
            </div>
        </div>

        <div id="rmDocumentsTopView" class="panel panel-primary">
            <div class="panel-heading">
                <h3 class="panel-title"><strong>Tài liệu đọc nhiều</strong></h3>
            </div>
            <div class="list-group">
            </div>
        </div>
    </div>
    <!-- /. Right menu-->
</div>

@section JS {
    <script src="~/Scripts/App/LibDocuments/ListDocumentsByCategory.js"></script>
    <script src="~/Scripts/Plugins/date.format.js"></script>
    <script type="text/javascript">
        var total = @ViewData["total"];
        var cateogryId = @ViewData["categoryId"];
        var libDocuments = new ListDocumentsByCategory(cateogryId, total, 5, 1, 'CreateDate');
        libDocuments.Init();
    </script>
}

